<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>代理模式</title>
</head>
<body>
<script>
    //代理模式需要三方
    //1.买家
    function maijia(){
        this.name = "小明";
        this.money = "30万";
    }
    //2.中介
    function zhongjie(){
    }
    zhongjie.prototype.maifang = function(){
        //new fongdong(new maijia()).maifang("20万");
        new fongdong(new maijia()).maifang("20万");
    }
    //3.卖家
    function fongdong(maijia){
        this.maijia_name = maijia.name;
        this.maijia_money = maijia.money;
        this.maifang = function(money){
//            alert("收到了来自【"+this.maijia_name+"】"+money+"人民币");
            alert("收到了来自【"+this.maijia_name+"】"+this.maijia_money+"人民币");
        }
    }

    (new zhongjie()).maifang();
</script>
</body>
</html>